package com.calvin.springcloud.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.calvin.springcloud.base.ResponseResult;
import com.calvin.springcloud.feign.user.UserFei;
import com.calvin.springcloud.model.user.User;

@RestController
@RequestMapping("consumerUser")
public class ConsumerUserController {
	
	@Autowired
	private UserFei userFei;
	
	@GetMapping("/hello")
	public String hello() {
		return "hello";
	}
	
	@GetMapping("/getUserList")
	public ResponseResult<List<User>> getUserList() {
		return userFei.getUserList();
	}
	
	@GetMapping("/getUserList/timeout")
	public ResponseResult<Object> getUserListTimeOut() {
		try {
			return userFei.getUserListTimeOut();
		} catch (Exception e) {
			e.printStackTrace();
			return new ResponseResult<Object>().fail(e.getMessage());
		}
		
	}
	
	
	


}
